package demo7;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.stereotype.Component;

/*
* 演示Spring容器管理一个对象的生命周期
* */
@Component
public class Demo {
    /*public static void main(String[] args) {
        System.out.println("创建Spring容器");
        AnnotationConfigApplicationContext context
                = new AnnotationConfigApplicationContext("demo7");
        System.out.println("Spring容器创建完毕");
        Person p = context.getBean(Person.class);
        System.out.println("通过Spring容器获取到对象:"+p);
        System.out.println("使用Person对象进行实际操作");

        System.out.println("最终关闭Spring容器");
        context.close();
    }*/
}
